#pragma once
#include "RationalNumber.h"
namespace org
{
	namespace spark
	{
		namespace math
		{

			using::org::spark::math::RationalNumber;

			/// <summary>
			/// Represents the time in a simulation
			/// @author Monad
			/// 
			/// </summary>

//ORIGINAL LINE: @SuppressWarnings("serial") public class SimulationTime implements Comparable<RationalNumber>, java.io.Serializable
			class SimulationTime
			{
				/* Counts the number of ticks */
			private:
			    long tick;

				/* Approximates 'continuous' time */
				RationalNumber *time;

				/* System time of the simulation start */
				long startTime;

				/* Time of the tick represented by the system clock */
				long tickTime;

				/* Time elapsed from the previous tick (in seconds) */
				double elapsedTime;

				/// <summary>
				/// Internal constructor </summary>
				/// <param name="tick"> </param>
				/// <param name="time"> </param>
			protected:
				SimulationTime(long long tick, RationalNumber *time);


				/// <summary>
				/// Initialized the class
				/// </summary>
			private:
				void init( long tick, RationalNumber *time,long startTime, long tickTime, double elapsedTime);

				void init(long tick, RationalNumber *time,long startTime);


				/// <summary>
				/// Copy constructor </summary>
				/// <param name="time"> </param>
			protected:
				SimulationTime(SimulationTime *time);


				/// <summary>
				/// Internal default constructor
				/// </summary>
// Calls to same-class constructors are not supported in C++ prior to C++11:
				SimulationTime(); //this(0, new RationalNumber(0));


				/// <summary>
				/// Resets the time
				/// </summary>
				virtual void reset();


				/// <summary>
				/// Returns the number of ticks
				/// @return
				/// </summary>
			public:
				virtual long getTick();


				/// <summary>
				/// Returns the time elapsed from the previous tick
				/// @return
				/// </summary>
				virtual double getElapsedTime();


				/// <summary>
				/// Returns the time elapsed from the beginning of the current simulation
				/// @return
				/// </summary>
				virtual double getTotalTime();


				/// <summary>
				/// Returns the simulation time
				/// @return
				/// </summary>
				virtual double getDoubleTime();


				/// <summary>
				/// Returns the exact time
				/// @return
				/// </summary>
				virtual RationalNumber *getTime();


				/// <summary>
				/// Advances ticks by one </summary>
				/// <param name="dt"> </param>
			
				virtual void advanceTick();


				/// <summary>
				/// Sets the time </summary>
				/// <param name="t"> </param>
				virtual void setTime(RationalNumber *t);


			public:
				virtual int compareTo(RationalNumber *t);
			};

		}
	}
}
